package com.cmxh.cloundnote.mapper;

import com.cmxh.cloundnote.pojo.Category;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author Sair
* @description 针对表【category】的数据库操作Mapper
* @createDate 2025-03-12 20:14:03
* @Entity com.cmxh.cloundnote.pojo.Category
*/
public interface CategoryMapper {
@Select("select * from category where create_user=#{id} and deleted=0")
List<Category> findAll(Integer id);
/**添加分类*/
    @Insert("insert into category(category_name,category_alias,create_user) values(#{categoryName},#{categoryAlias},#{createUser})")
    int addCategory(Category category);
    /**删除**/
    @Update("update category set deleted=1 where id=#{id}")
    int deleted(Integer id);
    //修改文章分类
    @Update("update category set category_name=#{categoryName},category_alias=#{categoryAlias} where id=#{id}")
    int updateCategory(Category category);
    @Select("select * from category where create_user=#{id} and deleted=0")
    List<Category>findById2(Integer id);
}
